#define _CRT_SECURE_NO_WARNINGS 1
#include <queue>
#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int N = 1e5 + 10;
const ull P = 131;
ull h[N];
ull p[N];
char s[N];
ull query(int r, int l)
{
	return h[r] - h[l - 1] * p[r - l + 1];
}
int main()
{
	int m, len;
	while (cin >> m >> len)
	{
		scanf("%s", s + 1);
		int n = strlen(s + 1);
		if (n < len * m)
		{
			cout << 0 << endl;
			continue;
		}
		h[0] = 0;
		p[0] = 1;
		for (int i = 1; i <= n; i++)
		{
			h[i] = h[i - 1] * P + s[i];
			p[i] = p[i - 1] * P;
		}
		int ans = 0;
		for (int i = 0; i < len; i++)
		{
			unordered_map<ull, int> mp;
			for (int j = i; j+len<=i+m*len && i + m * len <= n; j += len)
			{
				mp[query(j + len, j + 1)]++;
			}
			if (mp.size() == m) ans++;
			for (int j = len * m + i; j + len <= n; j += len)
			{
				int pre = j - len * m;
				ull num1 = query(pre + len, pre + 1);
				ull num2 = query(j + len, j + 1);
				mp[num1]--;
				if (mp[num1] == 0) mp.erase(num1);
				mp[num2]++;
				if (mp.size() == m) ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}
